##############################################################
## MOD Title:   Update Visual Confirmation for Cricca Guestbook v1.0.1 to v1.0.2
## MOD Author:  SemiX < michalski@teleos-web.de >
## MOD Version:	1.0.0
##
## Installation Level:	easy
## Installation Time:	5 Minutes
##
## Files To Edit:  guestbook.php
##      	   includes/usercp_confirm.php
##############################################################
## HINT: "Visual Confirmation for Cricca Guestbook" v1.0.1
##	 needs to be installed!
##############################################################
#
#-----[ DELETE ]----------------------------------------------
#
delete guestbook_confirm.php from includes/guestbook_confirm.php
#
#-----[ OPEN ]------------------------------------------------
#
guestbook.php
#
#-----[ FIND ]------------------------------------------------
#
  	if ( $mode == 'confirm' )
  	{
      include($phpbb_root_path . 'includes/guestbook_confirm.'.$phpEx);
      exit;
  	}
#
#-----[ REPLACE WITH ]----------------------------------------
#
  	if ( $mode == 'confirm' )
  	{
      $activate_cricca_guestbook = true;
      include($phpbb_root_path . 'includes/usercp_confirm.'.$phpEx);
    	exit;
  	}
#
#-----[ FIND ]------------------------------------------------
#
		$confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');

		list($usec, $sec) = explode(' ', microtime());
		mt_srand($sec * $usec);

		$max_chars = count($confirm_chars) - 1;
		$code = '';
		for ($i = 0; $i < 6; $i++)
		{
			$code .= $confirm_chars[mt_rand(0, $max_chars)];
		}
#
#-----[ REPLACE WITH ]----------------------------------------
#
		// Generate the required confirmation code
		// NB 0 (zero) could get confused with O (the letter) so we make change it
		$code = dss_rand();
		$code = strtoupper(str_replace('0', 'o', substr($code, 6)));
#
#-----[ OPEN ]------------------------------------------------
#
includes/usercp_confirm.php
#
#-----[ FIND ]------------------------------------------------
#
$sql = 'SELECT code  
	FROM ' . CONFIRM_TABLE . " 
	WHERE session_id = '" . $userdata['session_id'] . "' 
		AND confirm_id = '$confirm_id'";
#
#-----[ REPLACE WITH ]----------------------------------------
#
//-- mod : visual confirmation for cricca guestbook ------------------------------------------------
//-- remove
// $sql = 'SELECT code  
//  FROM ' . CONFIRM_TABLE . " 
//  WHERE session_id = '" . $userdata['session_id'] . "' 
//	  AND confirm_id = '$confirm_id'";
//-- add
$table_name = ( $activate_cricca_guestbook ) ? GUESTBOOK_CONFIRM_TABLE : CONFIRM_TABLE;
$sql = 'SELECT code  
	FROM ' . $table_name . " 
	WHERE session_id = '" . $userdata['session_id'] . "' 
  		AND confirm_id = '$confirm_id'";
//-- fin mod : visual confirmation for cricca guestbook --------------------------------------------
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM